
    /**  
    * @Title: PortalFieldLogServiceImpl.java
    * @Package com.efast.cafe.portal.service.company.impl
    * @Description: TODO(用一句话描述该文件做什么)
    * @author Administrator
    * @date 2019年1月18日
    * @version V1.0  
    */
    
package com.efast.cafe.portal.service.company.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.efast.cafe.framework.service.CafeServiceImpl;
import com.efast.cafe.framework.util.SpringWebUtils;
import com.efast.cafe.portal.dao.company.PortalFieldLogDao;
import com.efast.cafe.portal.entity.company.PortalFieldLog;
import com.efast.cafe.portal.service.company.PortalFieldLogService;
import com.efast.cafe.util.ConfigUtil;

/**
    * @ClassName: PortalFieldLogServiceImpl
    * @Description: TODO(这里用一句话描述这个类的作用)
    * @author Administrator
    * @date 2019年1月18日
    *
    */
@Service
public class PortalFieldLogServiceImpl extends CafeServiceImpl<PortalFieldLog> implements PortalFieldLogService{

	private PortalFieldLogDao portalFieldLogDao;
	
	@Autowired
	public void setPortalFieldLogDao(PortalFieldLogDao portalFieldLogDao) {
		this.portalFieldLogDao = portalFieldLogDao;
		this.mapper = portalFieldLogDao;
	}



	@Override
	public void insertLog(PortalFieldLog log) {
		log.setCompanyCode(SpringWebUtils.getRequestCompany());
		log.setUsername(SpringWebUtils.getRequestUser());
		log.setCreateTime(new Date());
		log.setModuleName(ConfigUtil.getValue("spring.application.name"));
		log.setSystemName(ConfigUtil.getSystemIndentifier());
		log.setSystemVersion(ConfigUtil.getSystemVersion());
		portalFieldLogDao.insert(log);
	}



	@Override
	public void insertLog(List<PortalFieldLog> logList) {
		List<PortalFieldLog> logs = new ArrayList<>();
		if(logList!=null && !logList.isEmpty()){
			logList.forEach(log->{
				log.setCompanyCode(SpringWebUtils.getRequestCompany());
				log.setUsername(SpringWebUtils.getRequestUser());
				log.setCreateTime(new Date());
				log.setModuleName(ConfigUtil.getValue("spring.application.name"));
				log.setSystemName(ConfigUtil.getSystemIndentifier());
				log.setSystemVersion(ConfigUtil.getSystemVersion());
				logs.add(log);
			});
		}
		if(!logs.isEmpty()){
			portalFieldLogDao.insertList(logs);
		}
	}

}
